﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using NewDDSys.Entity;
using NewDDSys.IBLL;
using NewDDSys.IDAL;
using NewDDSys.Factory;
using NewDDSys.Utility;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Web_YHGL : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        btnOK.Attributes.Add("onclick", "javascript:if(confirm('" + "确认无误，并提交么？" + "')== false) return false;");
    }
    protected void btnOK_Click(object sender, EventArgs e)
    {
        int checkValue = 0;
        YhInfo yh = new YhInfo();
        yh.Danwei = ddlDanwei.SelectedValue.ToString();
        yh.Bumen = txtBumen.Text.ToString();
        yh.Gang = txtGang.Text.ToString();
        yh.Xm = txtXm.Text.ToString();
        yh.Pass = txtPass.Text.ToString();
        yh.Num = txtNum.Text.ToString();
        checkValue = BLLFactory.CreateYhBLL().AddYh(yh);
        if (checkValue >= 1)
        {
            Response.Write(" <script   language=javascript> window.alert( ' 提交成功！ ');</script> ");
        }
        if (ddlBanzu.SelectedIndex != 0)
            BLLFactory.CreateYhBLL().UpdateBanzu(yh.Num, ddlBanzu.SelectedValue.ToString());
        Response.Redirect("YHJL.aspx");
    }
    protected void btnRepeat_Click(object sender, EventArgs e)
    {
        ddlDanwei.SelectedIndex = 0;
        ddlBanzu.SelectedIndex = 0;
        txtBumen.Text = "";
        txtGang.Text = "";
        txtXm.Text = "";
        txtNum.Text = "";
        txtPass.Text = "";
    }
}
